package router

import (
	"SE/controller"
	"SE/global"
	"SE/repository"
	"SE/service"
	"github.com/gin-gonic/gin"
)

func PRouter(Router *gin.RouterGroup) {
	p := Router.Group("/p")
	{
		pRepo := repository.NewPRepository(global.DB)
		pService := service.NewPService(pRepo)
		pController := controller.NewPController(pService)
		// 获取当前位置车库里面的车辆
		p.GET("/list", pController.PList)
		// 添加P
		p.POST("/add", pController.AddP)
		// 获取所有的停车场
		p.GET("/getAll", pController.GetAllP)
		// 修改停车场信息
		p.PUT("/update", pController.UpdateP)

		p.GET("/getMy", pController.GetMyp)
	}
}
